using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/// <summary>
/// Summary description for ScriptFunction
/// </summary>
public class ScriptFunction
{
    public ScriptFunction()
    {
        
    }
    public static void Alert(Page page, string str)
    {
        page.ClientScript.RegisterClientScriptBlock(page.GetType(), "_alert", "<script language=javascript>alert('" + str + "');</script>");
    }
    public static void ShowMsg_ScriptManager(string msg, Page p)
    {
        String JScode = "alert('" + msg + "');\n";
        ScriptManager.RegisterStartupScript((Page)p, Type.GetType("System.String"), "_alert", JScode, true);
    }
   
    public static void ShowMsg_ScriptManager2(string msg, string key, Page p)
    {
        String JScode = "alert('" + msg + "');\n";
        ScriptManager.RegisterStartupScript((Page)p, Type.GetType("System.String"), key, JScode, true);
    }
    public static void ShowMsgTranUrl_ScriptManager(string msg, Page p, string url)
    {
        String JScode = "alert('" + msg + "');\n";
        JScode += "window.location.href='" + url + "';";
        ScriptManager.RegisterStartupScript((Page)p, Type.GetType("System.String"), "_alert", JScode, true);
    }
    public static void ShowMsgTranOpennerUrl_ScriptManager(string msg, Page p, string url)
    {
        String JScode = "alert('" + msg + "');\n";
        JScode += "window.opener.location.href='" + url + "';";
        JScode += " window.close();";
        ScriptManager.RegisterStartupScript((Page)p, Type.GetType("System.String"), "_alert", JScode, true);
    }
    public static void ShowMsgAdd_ScriptManager(string msg, Page p, string url)
    {
        String JScode = "alert('" + msg + "');\n";
        JScode += "window.opener.location.href='" + url + "';";
        //JScode += " window.close();";
        ScriptManager.RegisterStartupScript((Page)p, Type.GetType("System.String"), "_alert", JScode, true);
    }
}
